﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _4.ChangeWordsInTagsToUppercase
{
    class ChangeWordsInTagsToUppercase
    {
        static string ConvertToUpperCase(string text)
        {
            int startIndex = text.IndexOf("<upcase>");
            int endIndex = text.IndexOf("</upcase>");
            while (startIndex != -1)
            {
                string temp = text.Substring((startIndex + 8), (endIndex - startIndex - 8));
                text = text.Replace(temp, temp.ToUpper());
                startIndex = text.IndexOf("<upcase>", startIndex + 1);
                endIndex = text.IndexOf("</upcase>", endIndex + 1);
            }
            return text;
        }
        static void Main(string[] args)
        {
            string text = "We are living in a <upcase>yellow submarine</upcase>. We don't have <upcase>anything</upcase> else.";
            string converted=ConvertToUpperCase(text);
            converted = converted.Replace("<upcase>", String.Empty);
            converted = converted.Replace("</upcase>", String.Empty);
            Console.WriteLine(converted);
        }
    }
}
